package org.example.basic.day03;

/**
 * 抽象类练习
 */
public class Demo抽象类练习 {
    public static void main(String[] args) {
       method(new AliPay(),"452323",1000,"ali_pay");
       method(new WeChatPay(),"252523",1000,"wechat_pay");
      method(new UnionPay(),"73e235",200,"UnionPay");
    }
    public static void method(PayBasic payBasic,String id,double amount,String channel) {
        payBasic.payment(amount);
        payBasic.pay_log(id,channel);
    }
}

interface  PayBasic{
      void payment(double  pay);
      void pay_log(String log_id,String channel);
}

class WeChatPay implements PayBasic{

    @Override
    public void payment(double pay) {
        System.out.println("[WeChatPay] 支付金额："+pay+" 元" );
    }

    @Override
    public void pay_log(String log_id, String channel) {
        System.out.println("[WeChatPay] 支付日志： 商户ID："+log_id+" 支付渠道: "+ channel);
    }
}
class AliPay implements PayBasic{

    @Override
    public void payment(double pay) {
        System.out.println("[AliPay] 支付金额："+pay+" 元" );
    }

    @Override
    public void pay_log(String log_id, String channel) {
        System.out.println("[AliPay] 支付日志： 商户ID："+log_id+" 支付渠道: "+ channel);
    }
}
class UnionPay implements PayBasic{
    @Override
    public void payment(double pay) {
        System.out.println("[UnionPay] 支付金额："+pay+" 元" );
    }

    @Override
    public void pay_log(String log_id, String channel) {
        System.out.println("[UnionPay] 支付日志： 商户ID："+log_id+" 支付渠道: "+ channel);
    }
}